import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../pages/home";
import Login from "../pages/login";
import Music from "../pages/home/music";
import News from "../pages/home/news";
import Games from "../pages/home/games";

Vue.use(VueRouter);

export default new VueRouter({
  routes: [
    {
      path: "/home",
      component: Home,
      children: [
        {
          path: "music/:id/:time?",
          component: Music,
          name: "music",
          props: true,
        },
        // {
        //     path: "games",
        //     component: Games,
        //     name: "games",
        //     props:{
        //       game1:"原神",
        //       game2:"王者荣耀",
        //       game3:"坎公骑冠剑"
        //     },
        //   },
        {
          path: "games",
          component: Games,
          name: "games",
          props(route) {
            return {
              ...route.query,
              ...{ game1: "原神", game2: "王者荣耀", game3: "坎公骑冠剑" },
            };
          },
        },
        { path: "news", component: News, name: "news" },
        { path: "", component: Music },
      ],
    },
    { path: "/login", component: Login },
    { path: "/", redirect: "home" },
  ],
});
